package day0522;

import java.util.Arrays;

public class Test5 {

    public static void main(String[] args) throws InterruptedException {
        while(true){
            input();
            move();
            System.out.println(Arrays.toString(a));//打印数组元素
            Thread.sleep(1000);
        }
    }

    static int[] a  =  {2};
    public static void input() {
        a= Arrays.copyOf(a,a.length+1);//给a数组中放入一个随机数
        a[a.length-1]=(int)(Math.random()*1000);//打印数组元素
    }

    public static void move() {//让a数组中的每个元素自增1
        for (int i = 0; i < a.length; i++) {
            int ele=a[i];
            a[i]= ele+1;//让a[i]比原来大1位//将a数组扩容一个空间，给a数组中放入一个等差数列的数(相邻的两个数差值为1)
        }
    }

}
